package com.whfc.ms.api.fse.service.impl;

import com.whfc.common.result.ListData;
import com.whfc.common.util.DateUtil;
import com.whfc.fse.dto.FseCraneDataDTO;
import com.whfc.fse.dto.FseCraneDataLogDTO;
import com.whfc.fse.service.FseCraneDataService;
import com.whfc.ms.api.fse.service.MsFseCraneDataService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @DESCRIPTION
 * @AUTHOR GuoDong_Sun
 * @DATE 2020/4/9
 */
@Service
public class MsFseCraneDataServiceImpl implements MsFseCraneDataService {

    private static final Logger logger = LoggerFactory.getLogger(MsFseCraneDataServiceImpl.class);

    @DubboReference(interfaceClass = FseCraneDataService.class, version = "1.0.0")
    private FseCraneDataService fseCraneDataService;

    @Override
    public FseCraneDataDTO latest(Integer craneId) {
        return fseCraneDataService.latest(craneId);
    }

    @Override
    public ListData<FseCraneDataLogDTO> log(Integer craneId, Date date) {
        Date startTime = DateUtil.getDateBegin(date);
        Date endTime = DateUtil.getDateEnd(date);
        return fseCraneDataService.log(craneId, startTime, endTime);
    }

    @Override
    public ListData<FseCraneDataLogDTO> log(Integer craneId, Date startTime, Date endTime) {
        return fseCraneDataService.log(craneId, startTime, endTime);
    }
}
